package com.zx._03_并发.chapter_08_threadLocal;

import java.lang.reflect.Field;
import org.springframework.util.ReflectionUtils;

public class 回收 {

    private static ThreadLocal<String> LOCAL = new ThreadLocal<String>();

    public static void main(String[] args) throws Exception {
        LOCAL.set("111");

        Field field = ReflectionUtils.findField(Thread.class, "threadLocals");
        field.setAccessible(true);
        Object object = field.get(Thread.currentThread());
        System.out.println(object);

        System.out.println(LOCAL.get());
        System.gc();

        System.out.println(LOCAL.get());
    }
}
